<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">
	
<ui:composition template="../template.xhtml">
	<ui:define name="content">
		<h:outputStylesheet library="css" name="richfaces.css" />
		<h1>List Stock Items</h1>
		<h:form>
			<rich:dataTable value="#{stockTypesBean.stockTypes}" var="stockType"
					iterationStatusVar="it" id="tableStockTypes"
					rowClasses="odd-row, even-row" styleClass="stable"
					rows="#{stockTypesBean.recordsPerPage}">
					
				<!-- Telo tabulky -->
				<rich:column sortBy="#{stockType.name}" id="name"
					sortOrder="#{stockTypesSortingBean.nameOrder}">
					<f:facet name="header">
						<a4j:commandLink value="Name" render="tableStockTypes"
							action="#{stockTypesSortingBean.sortByName}" />
					</f:facet>
					<h:outputText value="#{stockType.name}" />
				</rich:column>
				
				<rich:column sortBy="#{stockType.productClass}" id="productClass"
					sortOrder="#{stockTypesSortingBean.productClassOrder}">
					<f:facet name="header">
						<a4j:commandLink value="Product Class" render="tableStockTypes"
							action="#{stockTypesSortingBean.sortByProductClass}" />
					</f:facet>
					<h:outputText value="#{stockType.productClass}" />
				</rich:column>
				
				<rich:column sortBy="#{stockType.price}" id="price"
					sortOrder="#{stockTypesSortingBean.priceOrder}">
					<f:facet name="header">
						<a4j:commandLink value="Price" render="tableStockTypes"
							action="#{stockTypesSortingBean.sortByPrice}" />
					</f:facet>
					<h:outputText value="#{stockType.price} Kč" />
				</rich:column>
				
				<rich:column sortBy="#{stockType.totalAmount}" id="amount"
					sortOrder="#{stockTypesSortingBean.amountOrder}">
					<f:facet name="header">
						<a4j:commandLink value="Amount" render="tableStockTypes"
							action="#{stockTypesSortingBean.sortByAmount}" />
					</f:facet>
					<h:outputText value="#{stockType.totalAmount}" />
				</rich:column>
				
			</rich:dataTable>
		</h:form>
	</ui:define>
</ui:composition>
</html>